import feedparser
import re

def getwords(html):
  txt = re.compile(r'<[^>]+>').sub('', html)
  words = re.compile(r'[^A-Z^a-z]+').split(txt)
  print(txt)
  print('-' * 80)
  print(words)
  return words

def getwordcounts(url):
  d = feedparser.parse(url)
  for e in d.entries:
    if 'summary' in e: summary = e.summary
    else: summary = e.description
    words = getwords(e.title + ' ' + summary)

def parsefeeds(feedlist):
  urls = open(feedlist).readlines()
  for url in urls:
    getwordcounts(url)

if __name__ == '__main__':
  parsefeeds('feedlist.txt')

